#ifndef MSGCOMPL_H 
#define MSGCOMPL_H 

class MsgOutlets;
class MsgOutletPos;
class MsgPlugs;

class MsgCompiled
{
	public:
		MsgCompiled(MsgOutlets*, char* src, int32 srclen
#ifdef USE_MSGGENCACHE
			, uint8 srcMD4[16]
#endif
			);
		~MsgCompiled();

#ifdef USE_MSGGENCACHE
		uint8* getMD4() { return msgMD4; }
#endif
		int32 getAllocLen(int32 srclen, MsgOutlets*, MsgPlugs*); // '\0' incl

		MsgOutletPos* getFirstOutletPos() { return pos; }

	protected:
#ifdef USE_MSGGENCACHE
		uint8 msgMD4[16];
#endif
		MsgOutletPos* pos;
};

class MsgOutletPos
{
	friend class MsgCompiled;

	public:
		MsgOutletPos(int32 outletIndex, int32 offsetFromBeginning)
		{
			this->outletIndex = outletIndex;
			this->offset = offsetFromBeginning;
			next = (MsgOutletPos*)0;
		}

		int32 getOutletIndex() { return outletIndex; }
		int32 getOffsetFromBeginning() { return offset; }

		MsgOutletPos* getNextOutletPos() { return next; }

	protected:
		int32			outletIndex;
		int32			offset;
		MsgOutletPos*	next;
};

#endif
